/*
	TUIO C++ Library - part of the reacTIVision project
	http://reactivision.sourceforge.net/

	Copyright (c) 2005-2008 Martin Kaltenbrunner <mkalten@iua.upf.edu>

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/

#ifndef INCLUDED_TUIOOBJECT_H
#define INCLUDED_TUIOOBJECT_H

#include <list>
#include <math.h>

#ifndef M_PI
#define M_PI	3.14159265358979323846
#endif

#include "TuioContainer.h"

class TuioObject: public TuioContainer {

	protected:
		int fiducial_id;
		float angle;
		float rotation_speed, rotation_accel;

	public:
	TuioObject (long s_id, int f_id, float _xpos, float _ypos, float _angle):TuioContainer(s_id, _xpos, _ypos) {
		fiducial_id = f_id;
		angle = 2*M_PI-_angle;
		rotation_speed = 0.0f;
		rotation_accel = 0.0f;
	};

	TuioObject (TuioObject *tuioObject):TuioContainer(tuioObject) {
		fiducial_id = tuioObject->getFiducialID();
		angle = tuioObject->getAngle();
		rotation_speed = 0.0f;
		rotation_accel = 0.0f;
	};

	~TuioObject() {};

	void update (float _xpos, float _ypos, float _angle, float _xspeed, float _yspeed, float _rspeed, float maccel, float raccel) {
		TuioContainer::update(_xpos,_ypos,_xspeed,_yspeed,maccel);
		angle = 2*M_PI-_angle;
		rotation_speed = _rspeed;
		rotation_accel = raccel;
	};

	void update (TuioObject *tuioObject) {
		TuioContainer::update(tuioObject);
		angle = tuioObject->getAngle();
		rotation_speed = tuioObject->getRotationSpeed();
		rotation_accel = tuioObject->getRotationAccel();
	};

    /*void SetXYA(float _x, float _y, float _angle){
        this->xpos = _x;
        this->ypos = _y;
        this->angle = _angle;
    }*/

	int getFiducialID() { return fiducial_id; };

	float getAngle() { return angle; }
	float getAngleDegrees() { return (float)(angle/M_PI*180); }

	float getRotationSpeed() { return rotation_speed; };
	float getRotationAccel() { return rotation_accel; };

};

#endif
